<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <!-- 以借助 script 标签直接通过 CDN 来使用 Vue： -->
    <script src="./JS/vue.global.js"></script>
  </head>
  <body>
    <div id="app">
      姓：<input type="text" v-model="firstName" /> <br />名：<input
        type="text"
        v-model="lastName"
      />
      <br />
      <span>{{fullName()}}</span>
      <!-- 姓名：<span>{{ firstName.slice(0,2)}} {{lastName}}</span> -->
    </div>

    <script>
      Vue.createApp({
        data() {
          return {
            firstName: "张",
            lastName: "三",
          };
        },
        methods: {
          fullName() {
            return this.firstName.slice(0, 2) + this.lastName;
          },
        },
      }).mount("#app");
    </script>
  </body>
</html>
